package com.summer.boss.utils;


import java.util.HashMap;
import java.util.Map;

public class ThreadContextHolder {

    private static final ThreadLocal<Map<String, Object>> contextHolder = ThreadLocal.withInitial(HashMap::new);

    public static void set(String key, Object value) {
        contextHolder.get().put(key,value);
    }

    public static Map<String, Object> get() {
        return contextHolder.get();
    }

    public static Object get(String key) {
        return contextHolder.get().get(key);
    }

    public static void remove(String key) {
        contextHolder.get().remove(key);
    }

    public static void remove() {
        contextHolder.remove();
    }
}
